package com.drought.rained.presenter;

import com.drought.rained.BuildConfig;
import com.drought.rained.business.CustomConsumerLJ;
import com.drought.rained.business.ParamsFactoryLJ;
import com.drought.rained.cache.UserInfoLJ;
import com.drought.rained.mvpview.HelpMvpViewLJ;
import com.drought.rained.response.HelpCenterResponseLJ;

import io.reactivex.functions.Consumer;

public class HelpPresenterLJ extends BasePresenterLJ {
    private HelpMvpViewLJ mvpView;

    public HelpPresenterLJ(HelpMvpViewLJ mvpView) {
        this.mvpView = mvpView;
    }

    public void getHelpCenterData() {
        toSubScribe(req.getHelpCenter(BuildConfig.channel, UserInfoLJ.getToken(), ParamsFactoryLJ.getCommonParams(null)), new CustomConsumerLJ<HelpCenterResponseLJ>() {
            @Override
            public void call(HelpCenterResponseLJ updateResponse) {
                mvpView.onGetDataNext(updateResponse);
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable throwable) throws Exception {
                mvpView.onGetDataError(throwable);
            }
        });
    }

}
